struct domain_setup_info *dsi);
static int setup_guest(int xc_handle,
- u32 dom,
- char *image, unsigned long image_size,
- gzFile initrd_gfd, unsigned long initrd_len,
- unsigned long nr_pages,
- unsigned long *pvsi, unsigned long *pvke,
- vcpu_guest_context_t *ctxt,
- const char *cmdline,
- unsigned long shared_info_frame,
- unsigned int control_evtchn,
- unsigned long flags,
- unsigned int vcpus)
+ u32 dom,
+ char *image, unsigned long image_size,
+ gzFile initrd_gfd, unsigned long initrd_len,
+ unsigned long nr_pages,
+ unsigned long *pvsi, unsigned long *pvke,
+ unsigned long *pvss, vcpu_guest_context_t *ctxt,
+ const char *cmdline,
+ unsigned long shared_info_frame,
+ unsigned int control_evtchn,
+ unsigned long flags,
+ unsigned int vcpus,
+ unsigned int store_evtchn, unsigned long *store_mfn)
{
l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
unsigned long vphysmap_end;
unsigned long vstartinfo_start;
unsigned long vstartinfo_end;
+ unsigned long vstoreinfo_start;
+ unsigned long vstoreinfo_end;
unsigned long vstack_start;
unsigned long vstack_end;
unsigned long vpt_start;
vpt_end = vpt_start + (nr_pt_pages * PAGE_SIZE);
vstartinfo_start = vpt_end;
vstartinfo_end = vstartinfo_start + PAGE_SIZE;
- vstack_start = vstartinfo_end;
+ /* Place store shared page after startinfo. */
+ vstoreinfo_start = vstartinfo_end;
+ vstoreinfo_end = vstartinfo_end + PAGE_SIZE;
+ vstack_start = vstoreinfo_end;
vstack_end = vstack_start + PAGE_SIZE;
v_end = (vstack_end + (1<<22)-1) & ~((1<<22)-1);
if ( (v_end - vstack_end) < (512 << 10) )
" Phys-Mach map: %08lx->%08lx\n"
" Page tables: %08lx->%08lx\n"
" Start info: %08lx->%08lx\n"
+ " Store page: %08lx->%08lx\n"
" Boot stack: %08lx->%08lx\n"
" TOTAL: %08lx->%08lx\n",
dsi.v_kernstart, dsi.v_kernend,
vphysmap_start, vphysmap_end,
vpt_start, vpt_end,
vstartinfo_start, vstartinfo_end,
+ vstoreinfo_start, vstoreinfo_end,
vstack_start, vstack_end,
dsi.v_start, v_end);
printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
start_info->nr_pt_frames = nr_pt_pages;
start_info->mfn_list = vphysmap_start;
start_info->domain_controller_evtchn = control_evtchn;
+ start_info->store_page = vstoreinfo_start;
+ start_info->store_evtchn = store_evtchn;
if ( initrd_len != 0 )
{
start_info->mod_start = vinitrd_start;
start_info->cmd_line[MAX_CMDLINE-1] = '\0';
munmap(start_info, PAGE_SIZE);
+ /* Tell our caller where we told domain store page was. */
+ *store_mfn = page_array[((vstoreinfo_start-dsi.v_start)>>PAGE_SHIFT)];
+
/* shared_info page starts its life empty. */
shared_info = xc_map_foreign_range(
xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
free(page_array);
*pvsi = vstartinfo_start;
+ *pvss = vstack_start;
*pvke = dsi.v_kernentry;
return 0;
const char *cmdline,
unsigned int control_evtchn,
unsigned long flags,
- unsigned int vcpus)
+ unsigned int vcpus,
+ unsigned int store_evtchn,
+ unsigned long *store_mfn)
{
dom0_op_t launch_op, op;
int initrd_fd = -1;
unsigned long nr_pages;
char *image = NULL;
unsigned long image_size, initrd_size=0;
- unsigned long vstartinfo_start, vkern_entry;
+ unsigned long vstartinfo_start, vkern_entry, vstack_start;
if ( (nr_pages = xc_get_tot_pages(xc_handle, domid)) < 0 )
{
}
if ( setup_guest(xc_handle, domid, image, image_size,
- initrd_gfd, initrd_size, nr_pages,
- &vstartinfo_start, &vkern_entry,
- ctxt, cmdline,
- op.u.getdomaininfo.shared_info_frame,
- control_evtchn, flags, vcpus) < 0 )
+ initrd_gfd, initrd_size, nr_pages,
+ &vstartinfo_start, &vkern_entry,
+ &vstack_start, ctxt, cmdline,
+ op.u.getdomaininfo.shared_info_frame,
+ control_evtchn, flags, vcpus,
+ store_evtchn, store_mfn) < 0 )
{
ERROR("Error constructing guest OS");
goto error_out;
ctxt->user_regs.ss = FLAT_KERNEL_DS;
ctxt->user_regs.cs = FLAT_KERNEL_CS;
ctxt->user_regs.eip = vkern_entry;
- ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE;
+ ctxt->user_regs.esp = vstack_start + PAGE_SIZE;
ctxt->user_regs.esi = vstartinfo_start;
ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
/* Ring 1 stack is the initial stack. */
ctxt->kernel_ss = FLAT_KERNEL_DS;
- ctxt->kernel_sp = vstartinfo_start + 2*PAGE_SIZE;
+ ctxt->kernel_sp = vstack_start + PAGE_SIZE;
/* No debugging. */
memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
{
XcObject *xc = (XcObject *)self;
- u32 dom;
+ u32 dom;
char *image, *ramdisk = NULL, *cmdline = "";
- int control_evtchn, flags = 0, vcpus = 1;
+ int flags = 0, vcpus = 1;
+ int control_evtchn, store_evtchn;
+ unsigned long store_mfn = 0;
- static char *kwd_list[] = { "dom", "control_evtchn",
- "image", "ramdisk", "cmdline", "flags", "vcpus",
- NULL };
+ static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn",
+ "image", "ramdisk", "cmdline", "flags",
+ "vcpus", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssii", kwd_list,
- &dom, &control_evtchn,
- &image, &ramdisk, &cmdline, &flags, &vcpus) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssii", kwd_list,
+ &dom, &control_evtchn, &store_evtchn,
+ &image, &ramdisk, &cmdline, &flags,
+ &vcpus) )
return NULL;
if ( xc_linux_build(xc->xc_handle, dom, image,
- ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 )
+ ramdisk, cmdline, control_evtchn, flags, vcpus,
+ store_evtchn, &store_mfn) != 0 )
return PyErr_SetFromErrno(xc_error);
- Py_INCREF(zero);
- return zero;
+ return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
}
static PyObject *pyxc_plan9_build(PyObject *self,
#define MAX_CMDLINE 256
typedef struct {
- /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
- memory_t nr_pages; /* 0: Total pages allocated to this domain. */
+ /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
+ memory_t nr_pages; /* 0: Total pages allocated to this domain. */
_MEMORY_PADDING(A);
- memory_t shared_info; /* 8: MACHINE address of shared info struct.*/
+ memory_t shared_info; /* 8: MACHINE address of shared info struct. */
_MEMORY_PADDING(B);
- u32 flags; /* 16: SIF_xxx flags. */
+ u32 flags; /* 16: SIF_xxx flags. */
u16 domain_controller_evtchn; /* 20 */
u16 __pad;
- /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
- memory_t pt_base; /* 24: VIRTUAL address of page directory. */
+ /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
+ memory_t pt_base; /* 24: VIRTUAL address of page directory. */
_MEMORY_PADDING(C);
- memory_t nr_pt_frames; /* 32: Number of bootstrap p.t. frames. */
+ memory_t nr_pt_frames; /* 32: Number of bootstrap p.t. frames. */
_MEMORY_PADDING(D);
- memory_t mfn_list; /* 40: VIRTUAL address of page-frame list. */
+ memory_t mfn_list; /* 40: VIRTUAL address of page-frame list. */
_MEMORY_PADDING(E);
- memory_t mod_start; /* 48: VIRTUAL address of pre-loaded module. */
+ memory_t mod_start; /* 48: VIRTUAL address of pre-loaded module. */
_MEMORY_PADDING(F);
- memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */
+ memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */
_MEMORY_PADDING(G);
s8 cmd_line[MAX_CMDLINE]; /* 64 */
-} PACKED start_info_t; /* 320 bytes */
+ memory_t store_page; /* 320: VIRTUAL address of store page. */
+ _MEMORY_PADDING(H);
+ u16 store_evtchn; /* 328: Event channel for store communication. */
+} PACKED start_info_t; /* 332/336 bytes */
/* These flags are passed in the 'flags' field of start_info_t. */
#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */